home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13059 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.3 KB

  1. Path: newsstand.tc.umn.edu!usenet
  2. From: breid001@maroon.tc.umn.edu (Don Breidenbach)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: The philosophy of file I/O.
  5. Date: Sat, 23 Mar 1996 08:25:00 GMT
  6. Organization: University of Minnesota
  7. Message-ID: <4j05g2$c7c@epx.cis.umn.edu>
  8. References: <1996Mar19.155703.26730@alw.nih.gov>
  9. NNTP-Posting-Host: dialup-12-a-8.gw.umn.edu
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. systex@BALROG.NCI.NIH.GOV (Donald G. Plugge, Systex Inc.,
  13. (301)931-0500) wrote:
  14.  
  15.  
  16. >As a new convert to the C++ language, I'd like my practical application coding
  17. >to not only work, but to match the philosophy of object oriented guidelines. 
  18. >I'd like to get input from the C++ community on designing an actual solution. 
  19. >The goal of my small application is to read a particular type of file format
  20. >and perform calculations on the data.  I've been reading numerous books on the
  21. >subject of both C++ and object oriented programming, however, I'm keeping two
  22. >in mind while attacking this problem -- An Introduction To Object-Oriented 
  23. >Programming by Timothy Budd and C++ IOStreams Handbook by Steve Teale.  The
  24. >first book deals with the general concepts and the second deals with IO
  25. >specifically.
  26.  
  27. >The format of the files to be read are comprised of three sections as follows:
  28.  
  29. >1) A fixed format section containing an identifier and two sets of pointers. 
  30. >This section is of a fixed length.  The first set of pointers are byte offsets
  31. >into the second section.  The second set of pointers are byte offsets into the
  32. >third section.
  33.  
  34. >2) Text area which describes the data.
  35.  
  36. >3) Data area containing binary data.
  37.  
  38. >I'd like to use the CRC method of design outlined by Timothy Budd.  For those
  39. >of you unfamiliar with this method, individual classes are written on cue cards
  40. >along with class methods and other relavent class information.  So, I'd like to
  41. >break down the above problem in this manner.
  42.  
  43. >I was thinking of creating the following classes, but don't really know why:
  44.  
  45. >1) File Selection and control - a class to select the desired file, open the
  46. >file for reading, close the file and check the file status.
  47.  
  48. >2) Pointers - a class to handle the pointers.
  49.  
  50. >3) Text Area - a class for reading and searching the text area.
  51.  
  52. >4) Data Area - a class for reading the data area and performing calculations.
  53.  
  54. >Would anyone like to point out why or why not I'd like to break down the
  55. >problem in this manner?  And how I may communicate between classes?  For
  56. >instance, does the File control class want to perform all IO operations or
  57. >perhaps it would pass the file id to the other classes, so they can read their
  58. >respective areas.  The coding details aren't as important at this point.  I'd
  59. >like to understand the philosophy of file IO.  Other references would be
  60. >appriciated.
  61.  
  62. >                    Thanks,
  63. >                    Donald G. Plugge
  64.  
  65. Hello Don,
  66.     I would approach the problem of object design a little differently.
  67. Rather that deal with the functions to be performed, consider the
  68. problem domain as an abstract data type and approach it as a
  69. conceptual model. It's the old "I'm a file processing class and I know
  70. how to..." approach.
  71.     In your case you may not need that many classes, after all, your
  72. methods are all interested in contributing to the same general
  73. problem. You may really need only 1 class with 4 or 5 methods.
  74.     Hope this helps - another Don 
  75.  
  76.